package com.t235.gc.goods.controller;

import com.t235.gc.AjaxResult;
import com.t235.gc.entity.SysManager;
import com.t235.gc.mapper.SysManagerMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

@RestController
@CrossOrigin
@Api(tags = "演示模块的控制器，提供简单的swagge文档用法例子")
public class DomeController {
    @Autowired
    private SysManagerMapper sysManagerMapper;
    @Value("${server.port}")
    private String port;
    @ApiOperation(value = "演示方法1", notes = "演示方法，可以测试是否可以正常访问数据库")
    @GetMapping("/hello")
    public AjaxResult hello(HttpSession session) {
        return AjaxResult.success(port + ":" + session.getId() + ":hello world " + sysManagerMapper.FindByUsername("admin"));
    }
}
